<?php
	
	require_once("model/Foto.php");

	$key = ($_GET['palabra'] == null) ? '' : $_GET['palabra'];
	
	$foto = new Foto();
	
	$images = array();
	
	if(empty($key))
	
		$images = $foto->index();
		
	else
		
		$images = $foto->index(array('etiquetas'=>$key)); 
	
	if(count($images)>0):					
	?>

	<div class="imagen">
		
	<?php
		
		foreach($images as $image):
	
			?>		
			
			<img class="imgThumb" src="<?php echo $image['dir']; ?>" />
			
			<img class="imgFull" src="<?php echo $image['dir']; ?>" />
			
			<div class="imgDesc">
				<?php echo $image['nombre']; ?>: <?php echo $image['etiquetas']; ?>
			</div>
				
			<?php

		endforeach;
	
	?>
	</div>
	
	<?php

	endif;
	
	?>
	<script type="text/javascript">
	$(function(){
		$(".imagen").mbGallery( {
			galleryMaxWidth:480,
			galleryWidth:300,
			galleryHeight:300,
			galleryColor:"#333",
			galleryFrameBorder: 12,
			galleryFrameColor:"#fff",

			thumbStripPos: "right",
			thumbStripWidth:250,
			thumbSelectColor: "#fff",
			thumbOverColor : "#cccccc",
			thumbStripColor: "#333333",
			thumbsBorder: 4,
			thumbHeight:50,
			headerOpacity: .8,

			labelColor: "#333333",
			labelColorDisactive:"#333333",
			labelTextColor: "#ffffff",
			labelTextSize:"11px",
			labelHeight:20,

			startFrom:0,
			fadeTime: 500,
			autoSlide:true,
			autoSize : true,
			slideTimer: 6000,
			iconFolder: "img/slideshow/white",
			startTimer:0
		})
	});	
	</script>